#include "command.h"
#include "document.h"
#include "menuitem.h"

#include <iostream>

using namespace std;

int main()
{
	Document doc;

	CutCommand cutCmd(&doc);

	SimpleCommand<Document> copyCmd(&doc, &Document::copy, &Document::undoCopy);
	SimpleCommand<Document> pasteCmd(&doc, &Document::paste, &Document::undoPaste);

	CommandList cmdList;

	CutMenuItem cutMenuItem(&cutCmd, &cmdList);
	CutMenuItem copyMenuItem(&copyCmd, &cmdList);
	CutMenuItem pasteMenuItem(&pasteCmd, &cmdList);

	cutMenuItem.click();
	copyMenuItem.click();
	pasteMenuItem.click();
	cout<<endl;

	cmdList.undo();
	cmdList.redo();
	cout<<endl;

	cmdList.undoAll();
	cmdList.undo();
	cmdList.redoAll();
	cmdList.redo();
	cout<<endl;

	cutMenuItem.click();
	cout<<endl;

	return 0;
}
